﻿@using TjZheng.Power.DataEntity;
@inherits CMSWebViewPage<ButtonInfo>
@{
    ViewBag.Title = "按钮编辑";
    Layout = "~/Views/Shared/_EditLayout.cshtml";
}
@section Head{
    @Html.CreateDialogSource()
}
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false">
        <div class="top-block">
            @CurrentButtonTool.Create()
        </div>
        <form id="fr_buttoninfo" method="post" enctype="multipart/form-data">
            @*@Html.AntiForgeryToken()*@
            <table class="tblContent">
                <colgroup>
                    <col class="colTitle">
                    <col class="colContent" />
                </colgroup>
                <tr>
                    <td><span class="txtNoNull">*</span>按钮名称:</td>
                    <td>
                        @Html.Hidden("objProvide.Id", Model.Id, false)
                        @Html.StringBox("objProvide.ButtonName", Model.ButtonName, true, "请输入按钮名称", null, ValidType.Length(64))
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>按钮图标:</td>
                    <td>
                        @Html.StringBox("objProvide.Icon", Model.Icon, true, "请输入按钮图标", new { onchange = "PreviewIcon(this)" }, ValidType.Length(64))
                        <a href="javascript:void(0)" onclick="Search();" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true"></a>
                        预览图：<a id="icon_preview" class="easyui-linkbutton" data-options="iconCls:'@Model.Icon',plain:true"></a>
                        <div id="dialog_iconlist" class="easyui-dialog yhidden" title="图标列表" data-options="iconCls:'icon-save',closed:true,width:400,height:200">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>是否写入控制器:</td>
                    <td>
                        @Html.RadioButtonList("objProvide.IsWriteControllerName", Model.IsWriteControllerName, new List<SelectListItem>
                       {
                           new SelectListItem{Value="1",Text="是"},
                           new SelectListItem{Value="0",Text="否"},
                       })
                    </td>
                </tr>
                <tr>
                    <td>默认Action名称:</td>
                    <td>
                        @Html.StringBox("objProvide.DefaultActionName", Model.DefaultActionName, false, "请输入默认Action名称", null, ValidType.Length(64))
                    </td>
                </tr>
                <tr>
                    <td>默认位置:</td>
                    <td>
                        @Html.RadioButtonList("objProvide.DefaultPosition", Model.DefaultPosition, new List<SelectListItem>
                   {
                       new SelectListItem{Value="0",Text="无",Selected=true},
                       new SelectListItem{Value="1",Text="顶部工具栏"},
                       new SelectListItem{Value="2",Text="右键工具栏"},
                       new SelectListItem{Value="3",Text="普通工具栏"}
                   })
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>默认执行脚本:</td>
                    <td>
                        @Html.StringBox("objProvide.DefaultExecution", Model.DefaultExecution, true, "请输入默认执行脚本", null, ValidType.Length(64))
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
@section Bottom{
    <script type="text/javascript">
        function Save() {
            var objFormEntity = new FormEntity("#fr_buttoninfo");
            objFormEntity.url = "/buttoninfo/save/";
            objFormEntity.submitSuccess = function (InvokeResult) {
                if (InvokeResult.ResultCode == "Success") {
                    ShowMessage(InvokeResult.ResultMessage);
                    Back();
                } else {
                    ShowMessage(InvokeResult.ResultMessage);
                }
            };
            objFormEntity.isClearData = false;
            objFormEntity.submit();
        }
        function Back() {
            window.location.href = "/ButtonInfo";
        }
        function Search() {
            var objBizDialog = new BizDialog("#dialog_iconlist",
            {
                href: "/iconinfo/iconlist?dialog=dialog_iconlist",
                onClose: function () {
                    var $icon = $("#objProvide_Icon");
                    var icon = GetItem("dialog_iconlist");
                    $icon.val(icon);
                    $icon.validatebox();
                    $("#icon_preview").linkbutton({ iconCls: icon });
                }
            });
            objBizDialog.open();
        }
        function PreviewIcon(source) {
            var icon = $(source).val();
            $("#icon_preview").linkbutton({ iconCls: icon });
        }
    </script>
}
